<?php
class CategoryController extends AuthController{
	private $db;
	public function __init(){
		$this->db=new CategoryModel;
	}
	//显示栏目列表
	public function index(){
		$data =$this->db->getAll();
		$this->assign('data',$data);
		$this->display('index.html');
	}
	//添加栏目
	public function add(){
		if(IS_POST){
			if($this->db->addCategory($_POST)){
				$this->success('添加成功',__CONTROLLER__);
			}else{
				$this->error($this->db->error);
			}
		}else{
			$this->display('add.html');
		}
	}
}
?>
